package academic.emailClient.model.entities;

import java.util.ArrayList;
import java.util.Date;
import java.util.UUID;

public class MeetingBuilder  {
	
	private UUID id;
	private String location;
	private ArrayList<String> attendees;
	private String purpose;
	private String description;
	private Date start;
	private Date end;
	private int duration;
	private String owner;
	private int version;
	
	/**
	 * Meeting Builder
	 */
	public MeetingBuilder () {
		super();
	}
	
	/**
	 * Meeting Builder withId
	 * @param id
	 * @return
	 */
	public MeetingBuilder withId(UUID id) {
		this.id = id;
		return this;
	}
	
	/**
	 * Builds a meeting with an owner
	 * @param owner Owner of the meeting
	 * @return
	 */
	public MeetingBuilder withOwner(String owner){
		this.owner = owner;
		return this;
	}

	/**
	 * Meeting Builder withLocation
	 * @param location
	 * @return
	 */
	public MeetingBuilder withLocation(String location) {
		this.location = location;
		return this;
	}

	/**
	 * Meeting Builder withAttendees
	 * @param attendees
	 * @return
	 */
	public MeetingBuilder withAttendees(ArrayList<String> attendees) {
		this.attendees = attendees;
		return this;
	}

	/**
	 * Meeting Builder withPurpose
	 * @param purpose
	 * @return
	 */
	public MeetingBuilder withPurpose(String purpose) {
		this.purpose = purpose;
		return this;
	}

	/**
	 * MeetingBuilder withDescription
	 * @param description
	 * @return
	 */
	public MeetingBuilder withDescription(String description) {
		this.description = description;
		return this;
	}

	/**
	 * Meeting Builder withStart
	 * @param start
	 * @return
	 */
	public MeetingBuilder withStart(Date start) {
		this.start = start;
		return this;
	}

	/**
	 * Meeting Builder withEnd
	 * @param end
	 * @return
	 */
	public MeetingBuilder withEnd(Date end) {
		this.end = end;
		return this;
	}
	
	/**
	 * Meeting Builder withDuration
	 * @param duration
	 * @return
	 */
	public MeetingBuilder withDuration(int duration){
		this.duration = duration;
		return this;
	}
	
	public MeetingBuilder withVersion(int version){
		this.version = version;
		return this;
	}
	
	/**
	 * Building the meeting object
	 * @return
	 */
	public Meeting build(){
		if (this.id == null)
			return new Meeting(owner, location, attendees, purpose, description, start, duration);
		return new Meeting(id, owner, location, attendees, purpose, description, start, end, duration, version);
	}
	

}
